﻿using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace UCHENG.FILEHASH.UTILS
{
    public class HttpService
    {
        private const string API_PLAYER_GROUPS = "http://esp-developer-service.edu.web.sdp.101.com/v0.1/players/{0}/versions/{1}/groups";

        public static string getPlayerUrl (string playerCode, string version)
        {
            Uri uri = new Uri(String.Format(API_PLAYER_GROUPS, playerCode, version));
            HttpClient httpClient = new HttpClient();
            return httpClient.GetStringAsync(uri).Result;
        }


        private const string API_MODULE_LIST = "http://esp-developer-service.edu.web.sdp.101.com/v0.1/heaps/{0}/versions/{1}";

        public static string getModuleList(string playerCode, string version)
        {
            Uri uri = new Uri(String.Format(API_MODULE_LIST, playerCode, version));
            HttpClient httpClient = new HttpClient();
            return httpClient.GetStringAsync(uri).Result;
        }

    }
}